﻿namespace A2DFramework.OSGI
{
    using A2DFramework.OSGI.Configuration;
    using A2DFramework.OSGI.Processors;
    using System;

    public sealed class BundleRuntime : IDisposable
    {
        private BundleRuntimeProcessor processor;

        public void Dispose()
        {
            if (this.processor != null)
            {
                this.processor.Dispose();
            }
            this.processor = null;
        }

        public void Start()
        {
            this.processor = new BundleRuntimeProcessor(ManifestsConfigParser.LoadGlobalSetting(), ManifestsConfigParser.LoadManifests());
            this.processor.Initialize();
        }

        public void Stop()
        {
            this.processor.Stop();
        }
    }
}

